﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
if sid="Null" then Response.Redirect "/login.asp?sid="&sidd&"&url=/game/fish/index.asp"
sangong.tj
IF  Request.QueryString("Action")="login" Then
	call loginn
else
	call index
end if
end Function

Function index
        dim pid,mon,body
	pid=Request.QueryString("pid")
	if pid="" then pid=1
	if not isnumeric(pid) then pid=1
	pid=clng(pid)
        mon=sangong.namejian("money",pid)
select case v
case "0"
we0="<br/>"
hr="----------------<br/>"
body="下注(随机)<a href='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;mid="&int(mon/5)&"&amp;Action=login&amp;sid=" & sidd & "'>"&int(mon/5)&"</a>.<a href='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;mid="&int(mon/2)&"&amp;Action=login&amp;sid="&sidd&"'>"&int(mon/2)&"</a>.<a href='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;mid="&mon&"&amp;Action=login&amp;sid="&sidd&"'>"&mon&"</a><br/><input name='mid' format='*N' size='15' value='"&mon&"' maxlength='10'/><br/>最高不能超过"&mon&"<br/>选择<select name='jidao'><option  value='1'>剪刀</option><option  value='2'>石头</option><option  value='3'>布</option></select><anchor>出手<go href='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;Action=login&amp;sid="&sidd&"' method='post'><postfield name=""mid"" value=""$(mid:n)"" /><postfield name=""jidao"" value=""$(jidao)"" /></go></anchor><br/>"
%>
<card id="main" title="剪刀对战"><p align="<%=qingtian.px%>">
<%
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
we1="</div>"
body="<div class=""footer"">下注(随机)<a href='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;mid="&int(mon/5)&"&amp;Action=login&amp;sid=" & sidd & "'>"&int(mon/5)&"</a>.<a href='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;mid="&int(mon/2)&"&amp;Action=login&amp;sid=" & sidd & "'>"&int(mon/2)&"</a>.<a href='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;mid="&mon&"&amp;Action=login&amp;sid=" & sidd & "'>"&mon&"</a></div><form action='gamedd.asp?pid="&pid&"&amp;id="&id&"&amp;Action=login&amp;sid="&sidd&"' method='post'><input emptyok='true' format='*N' type='text' name='mid' value='"&mon&"' size='15'/><br/><div class=""block4"">最高不能超过"&mon&"</div>选择<select name='jidao'><option  value='1'>剪刀</option><option  value='2'>石头</option><option  value='3'>布</option></select><input type='submit' value='出手'/></form><br/>"
%>
<title>剪刀对战</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
%>
<%=dao%><a href='index.asp?sid=<%=sidd%>'>房间</a>|<a href='main.asp?id=<%=pid%>&amp;sid=<%=sidd%>'>玩法</a>|<a href='new.asp?sid=<%=sidd%>'>排行</a>|<a href='gamedd.asp?act=2&amp;Action=login&amp;sid=<%=sidd%>'>退出</a><%=we0%><%=body%>
<%=sou%>账户:<%=zi%><%=conn.execute("select money from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("money")%><%=zi0%><%=qingtian.bi%><%=we0%>

<%
end Function

Function loginn
dim id,a,b,nid,rs,sql,i,d,rss,sqls,mynid,mon,mid,pid
	pid=Request.QueryString("pid")
	if pid="" then pid=1
	if not isnumeric(pid) then pid=1
	pid=clng(pid)
	id=100000
mynid=qingtian.nid
if Request.QueryString("act")=2 then
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("ton")=0
                rs("time")=now()
                rs("aid")=0
                rs("bid")=0
                rs("a")=0
                rs("b")=0
	rs.update
        end if
	Rs.close
       set rs=nothing
Response.Redirect "index.asp?sid="&sidd&"&id="&pid
end if
select case v
case "0"
we0="<br/>"
hr="----------------<br/>"
%>
<card id="main" title="剪刀对战"><p align="<%=qingtian.px%>">
<%
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
we1="</div>"
%>
<title>剪刀对战</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
        mon=sangong.namejian("money",pid)
	mid=Request("mid")
	if mid="" then mid=10
	if not isnumeric(mid) then mid=10
	mid=clng(mid)
        if mid>mon then qingtian.err("下注金额不能超过"&mon&"")
        Randomize()
        ad=int(rnd*2+1)
	jidao=Request.form("jidao")
	if jidao="" then jidao=int(rnd*2+1)
	if not isnumeric(jidao) then jidao=int(rnd*2+1)
	jidao=clng(jidao)
select case jidao
case "1"
jiandao="剪刀"
case "2"
jiandao="石头"
case "3"
jiandao="布"
End Select
qingtian.info
toname=cn.execute("select toname from [qingtian_fangjian] where id="&pid&"")("toname")
if sangong.namere("aid",mynid)<>0 and sangong.namere("aid",mynid)<>id then
qingtian.err("你还在游戏中<a href='gamedd.asp?pid="&pid&"&amp;id="&sangong.namere("aid",mynid)&"&amp;sid=" & sidd & "'>返回继续游戏</a>")
end if 
sangong.pd(pid)
%>
<%=dao%><a href='index.asp?sid=<%=sidd%>'>房间</a>|<a href='main.asp?id=<%=pid%>&amp;sid=<%=sidd%>'>玩法</a>|<a href='new.asp?sid=<%=sidd%>'>排行</a>|<a href='gamedd.asp?act=2&amp;Action=login&amp;sid=<%=sidd%>'>退出</a><%=we0%>
<%=sou%><%=toname%> ＰＫ　<%=qingtian.utf8(session("username"))%><%=we0%><%=hr%><%=we%>
<%

	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("ton")=1
                rs("time")=now()
                rs("aid")=id
                rs("bid")=pid
                rs("a")=jidao
	rs.update
        end if
	Rs.close
        set rs=nothing
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where nid="&mynid&" order by nid asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then
                lui=sangong.namejian("pid",pid)
                d=0
                mon=mid
                a=rs("a")-ad
                if a=1 or a=-2 then
                rs("shen")=rs("shen")+1
                rs("d")=int(mon)*(1-lui/100)
                qingtian.pay int(mon)*(1-lui/100),rs("nid")
                d=int(mon)+d 
                rs("m")=rs("m")+int(mon)*(1-lui/100)
                elseif a=2 or a=-1 then
                rs("shu")=rs("shu")+1
                rs("m")=rs("m")-int(mon)
                rs("d")=-int(mon)
                qingtian.pay -int(mon),rs("nid")
                d=d-int(mon)
                elseif a=0 then
                rs("d")=0
                d=d
                end if 
	        rs.update                            
                end if
       Rs.close
       set rs=nothing                 
          if sangong.namere("d",mynid)<0 then
          Response.Write("很遗憾你输了,系统自动扣除你"&zi&""&abs(sangong.namere("d",mynid))&""&qingtian.bi&""&zi0&"!<br/>") 
          qingtian.addong("在游戏[url=/game/jidao/index.asp?sid=[sid]]剪刀对战[/url]中输掉了"&qingtian.bi&"")        
          elseif sangong.namere("d",mynid)>0 then
          Response.Write("恭喜,你赢了系统为你增加"&zi&""&sangong.namere("d",mynid)&""&qingtian.bi&""&zi0&"!<br/>") 
          qingtian.addong("在游戏[url=/game/jidao/index.asp?sid=[sid]]剪刀对战[/url]中赢得了"&qingtian.bi&"")
          else
          Response.Write("本局平局,系统不扣除"&qingtian.bi&"<br/>")
          end if
                if ad=1 then
                aaa="剪刀"
                elseif ad=2 then  
                aaa="石头"
                else
                aaa="布"
                end if
          Response.Write(""&toname&"出拳"&zi&"(庄)"&zi0&"："&zi&""&aaa&""&zi0&"<br/>")
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then
                if rs("a")=1 then
                aa="剪刀"
                elseif rs("a")=2 then  
                aa="石头"
                else
                aa="布"
                end if
                Response.Write("你出拳："&zi&""&aa&""&zi0&"<br/>")                
                end if
       Rs.close
       set rs=nothing 
          Response.Write("是否继续游戏:<br/>1.<a href='gamedd.asp?pid="&pid&"&amp;sid="&sidd&"'>继续</a><br/>2.<a href='gamedd.asp?act=2&amp;Action=login&amp;sid="&sidd&"'>退出</a><br/>")
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("ton")=0
                rs("time")=now()
                rs("aid")=0
                rs("bid")=0
                rs("a")=0
                rs("b")=0
	rs.update
        end if
	Rs.close
        set rs=nothing
%>
<%=we1%><%=hr%><%=sou%>账户:<%=zi%><%=conn.execute("select money from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("money")%><%=zi0%><%=qingtian.bi%><%=we0%>
<%
end function
%>